UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UJt595TDhhwgXGOgn+PyRKWDVcnuXC6vhe+hoDSzbRY='
WHERE
key_id = 'c54a1ddb6b7f29448bef62e63fde130153036ef8c7e31f1a8cc6ba0a3b23db4d'
AND (
token = 'UJt595TDhhwgXGOgn+PyRKWDVcnuXC6vhe+hoDSzbRY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)