UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ix02ilL07xXdM5XpVnPP5wi6ffb3aHw2XCUo3FG9ltA='
WHERE
key_id = '9c659eb865f54669fc82e7b47fee17942f5ffd0fe15c59fe097ac3505557bfa3'
AND (
token = 'ix02ilL07xXdM5XpVnPP5wi6ffb3aHw2XCUo3FG9ltA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)