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

Query time 0.00028