UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lSQSKeJytzsjNYsiv7l2FjkjGhW34/eWNN3jEivN5NY='
WHERE
key_id = 'aa8338808af83953e6644ac4ba2eabd80863d1a85f05c977b9104597c9b4ddce'
AND (
token = 'lSQSKeJytzsjNYsiv7l2FjkjGhW34/eWNN3jEivN5NY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)