UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aBPDjcCtA0B7+e2aFCJ1sqZSF4FAx28JDIsLuiOKQvg=' 
WHERE 
  key_id = '2142de68507f5357fbdc9536f5b7ebf85af7ba247eac67eddf7a4c65ac30b7f7' 
  AND (
    token = 'aBPDjcCtA0B7+e2aFCJ1sqZSF4FAx28JDIsLuiOKQvg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021