UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yJPN6IGXIRAD6mKcImI95C/2jwL47Uhf2kVYMc3hkYA='
WHERE
key_id = 'afa01c76b2e32e4053dd85d12b3438aa09db88fe60bb6c193b2e7b6bf1d84a73'
AND (
token = 'yJPN6IGXIRAD6mKcImI95C/2jwL47Uhf2kVYMc3hkYA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)