UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f2+XRGK5zVAqqd85cH6l9hWJUfkOttZUkLos6H4abdA='
WHERE
key_id = '8d9f34d03f3ba2daedc7e75c7a59b3363d88570ce671a90da9e9046a70de7580'
AND (
token = 'f2+XRGK5zVAqqd85cH6l9hWJUfkOttZUkLos6H4abdA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)