UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BSRNQS3S5miVrBjoRhBPZj5s5F06fpln5rQqP5WddKM='
WHERE
key_id = '49f2ac6ce3377a653f3afb702da8aa7d924aa6c79ce74174a7838c8d674e4af0'
AND (
token = 'BSRNQS3S5miVrBjoRhBPZj5s5F06fpln5rQqP5WddKM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)