UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AnayheOud8PQskPweO+opZEeA5OxFX5P18T8Mn/aebk=' 
WHERE 
  key_id = '5bf635485eb30cae5e751af33eceb465b9c7bbdc43cf3394e01079e693c416f5' 
  AND (
    token = 'AnayheOud8PQskPweO+opZEeA5OxFX5P18T8Mn/aebk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030