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