UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wi6G+Rj8tfOV6h/12ht9da2hg07niZarfjIKDMgLU2I=' 
WHERE 
  key_id = '0e237df735ad8639490c74ae23ff6f404c0167dc8f4fb03f6ec49d1982702730' 
  AND (
    token = 'Wi6G+Rj8tfOV6h/12ht9da2hg07niZarfjIKDMgLU2I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028