UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vAmFlJq+Jk4bMuEQ7QfcVcalcXXdjPTLIvcKyq4gjdQ=' 
WHERE 
  key_id = '4d8842abbef548b68462018833d49ef11af8ee35953fd743afeee8a2f6643318' 
  AND (
    token = 'vAmFlJq+Jk4bMuEQ7QfcVcalcXXdjPTLIvcKyq4gjdQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019