UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o7z9klsGkdaVe8fcqjBXy00/naTipDTt5XYrUlN+a4Q=' 
WHERE 
  key_id = '324b0a95ed90d4a114bec6702c9e975add465b444f956a61c65ea7b843b96729' 
  AND (
    token = 'o7z9klsGkdaVe8fcqjBXy00/naTipDTt5XYrUlN+a4Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028