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

Query time 0.00027