UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+O9wfMS7xirQQHKX2cd0n7qwhIpwH1FcU4qvLBcZuHk='
WHERE
key_id = 'f217db288ba3cfff0be61909d6fbad0e5fe9d19624d3d234dbe958f97f266b5f'
AND (
token = '+O9wfMS7xirQQHKX2cd0n7qwhIpwH1FcU4qvLBcZuHk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)