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