UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KLnaOMCRAgIlnj4sHVCJCb/+4bGwLNsU70HLim4AXEA='
WHERE
key_id = 'd98eb6935e6381eacb8d875f552499cc8c66f4f160275e401e812b97d968c085'
AND (
token = 'KLnaOMCRAgIlnj4sHVCJCb/+4bGwLNsU70HLim4AXEA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)