UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'epoMXUZynUvjCwssPM+XJR4cY0BFGFyWXwwYjDLIfys=' 
WHERE 
  key_id = 'd632d6459f8c58bd7805899c165c82ee871800d7325f8fab28ed4305bc8a6be9' 
  AND (
    token = 'epoMXUZynUvjCwssPM+XJR4cY0BFGFyWXwwYjDLIfys=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022