UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8DTa196QjeXB+ozV1/Ei+8RrlKCFaP3y7u1roTP49BQ=' 
WHERE 
  key_id = 'fb5c1525277aab25f5b7ad713ae75c27919321721ac9c06ba759bdb12af92f40' 
  AND (
    token = '8DTa196QjeXB+ozV1/Ei+8RrlKCFaP3y7u1roTP49BQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028