UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4lgeLb1ET3Pq0KVN6ey4soN/+bxGa2Rg/qgP2kPTDMw='
WHERE
key_id = '93ed40b1377bd4e06932044c850d4e89b05c6869df65e9d9e808144b357c3b05'
AND (
token = '4lgeLb1ET3Pq0KVN6ey4soN/+bxGa2Rg/qgP2kPTDMw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)