UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4WjjQXlfSemuIBdMrKxt43BijeeR+NG+37AYdBZSKKU=' 
WHERE 
  key_id = 'f35ee7d9d850a41fe7d2b4597e10f5082a79127ba679d9d0ce65ebbee07b3d30' 
  AND (
    token = '4WjjQXlfSemuIBdMrKxt43BijeeR+NG+37AYdBZSKKU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037