UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XGRz5EHZRVmFi7TvFJVhz1jCfi2FNwRqaMaFpBz4Lgc=' 
WHERE 
  key_id = '90894e5b21a890d2860ca027aff2fea4c1fe51273894e68f191f606f65cb1aa2' 
  AND (
    token = 'XGRz5EHZRVmFi7TvFJVhz1jCfi2FNwRqaMaFpBz4Lgc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026