UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ipOV/7sFqaui/cEkku/UKY9JaJN4+j6VFwvMItb5rT0='
WHERE
key_id = '2908c1645bbf308c210eb26c46b05256c3f640a345b8973f56006ba4e0bedd85'
AND (
token = 'ipOV/7sFqaui/cEkku/UKY9JaJN4+j6VFwvMItb5rT0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)