UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9GgyJ6tBP/PTRbsfx0BREJMZ9pshjTOjisHKFHq+OPQ=' 
WHERE 
  key_id = '40ae402500ab53d417854d5568b3fd4e7b8a53061022093ccace8eaec7870831' 
  AND (
    token = '9GgyJ6tBP/PTRbsfx0BREJMZ9pshjTOjisHKFHq+OPQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049