UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4SurefPuE0XMX9BZ2bkMiHndbcUdKVaPgxGOqc93Ahw='
WHERE
key_id = 'e48f831e386190ca68cae707706df47fac46b8ae5d2e78d2a696d27c685951a1'
AND (
token = '4SurefPuE0XMX9BZ2bkMiHndbcUdKVaPgxGOqc93Ahw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)