UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6WAgOLHFfEd+GvGwOz9V+Vr6XGlfu+5nESC3E243OfI='
WHERE
key_id = 'dab702bf797298ce98fe095366a24d351a1664474208eb060ee6fc9570190a35'
AND (
token = '6WAgOLHFfEd+GvGwOz9V+Vr6XGlfu+5nESC3E243OfI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)