UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sItnpGYtCIgjbturfaw+0/yaud25C16LcWe913/zllk=' 
WHERE 
  key_id = '4bec78ec66632565709946b03917134ccbb341a7d4e83f0bd8aa0caeb7f06f77' 
  AND (
    token = 'sItnpGYtCIgjbturfaw+0/yaud25C16LcWe913/zllk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053