UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cfBX1XBx1g/9Ta6hLvLv5JVOImQ3PqN6XD4dgKCX8+4=' 
WHERE 
  key_id = '714396ea66872503d6acab81dc5ec832b16f7dc8bf7332c3aa53faf9477f6c49' 
  AND (
    token = 'cfBX1XBx1g/9Ta6hLvLv5JVOImQ3PqN6XD4dgKCX8+4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041