UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dH1bir5LAJ2XBWn+GsEuREO4poRXbdiv371EJD5jQyI=' 
WHERE 
  key_id = 'af6ce9bce143f1616650edb35a615d7c9ac3b320288a38e08b29b7369e8d0c45' 
  AND (
    token = 'dH1bir5LAJ2XBWn+GsEuREO4poRXbdiv371EJD5jQyI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022