UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JTrRno45dMNjwrs4igHG4NQSS8NItb/04o1Y0URouzQ=' 
WHERE 
  key_id = '52382ea7355516038f2dfd63fefeb7f46eb7274cb093286399f00993e0590104' 
  AND (
    token = 'JTrRno45dMNjwrs4igHG4NQSS8NItb/04o1Y0URouzQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047