UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8uPOdJtNygUruMgfXnSIKAytrfJnfBep3oJxGUtcjdI=' 
WHERE 
  key_id = '9eca51b81c3bfd7c1556eda792112d9755904d6191ecb68823b4e8b790387253' 
  AND (
    token = '8uPOdJtNygUruMgfXnSIKAytrfJnfBep3oJxGUtcjdI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032