UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jZpyOAof3TEBOcZHByFL8pYI8W9rYXkMdi4HTdcFtps='
WHERE
key_id = 'f5b39a92e9bd3a04d7da33e39950408a7a60ef544a3a21f03960e025acc54446'
AND (
token = 'jZpyOAof3TEBOcZHByFL8pYI8W9rYXkMdi4HTdcFtps='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)