UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CUar1q7kf0hIA+H8UImNnwZ4afWrAo/g7EtEYTNidGo='
WHERE
key_id = 'af7a8a9077e1a0e36231eb68a25949352bd493b0c0c7be6c825253bfccbb3d82'
AND (
token = 'CUar1q7kf0hIA+H8UImNnwZ4afWrAo/g7EtEYTNidGo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)