UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JfT7z71KVuEGti9uC6BrPUiJ/ezo2C984SJxtZX4+/E='
WHERE
key_id = '9d5f7a1e6c6c6e28fd0f01134a5c1dc1e3625e70646f130df4d599d49a0b9cfe'
AND (
token = 'JfT7z71KVuEGti9uC6BrPUiJ/ezo2C984SJxtZX4+/E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)