UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qxVtRdIh3e0otmbk6Pen6MtggsrRwHhKSAsezF2OeA8=' 
WHERE 
  key_id = 'e5a27b57e5695fc359f87c220769c5a4d677a0e5e6963d07c5fcbce425770395' 
  AND (
    token = 'qxVtRdIh3e0otmbk6Pen6MtggsrRwHhKSAsezF2OeA8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033