UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cOulQCh7HqeM9MhA60eXItP6Ch1y6VOPmPV2YhgKnu0='
WHERE
key_id = 'fe9dacd5ec57384edf27589e6b66fbb75e66d329c827f432bd9eb105c8f8a811'
AND (
token = 'cOulQCh7HqeM9MhA60eXItP6Ch1y6VOPmPV2YhgKnu0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)