UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jv18j3m+k/fRx+ztAskE+xCJVBz6vffLp2HVBjgOrPU=' 
WHERE 
  key_id = '883b11aaa7f21514d70645d93763754f625e4944a93d5d80bfa8cacc1ab7a5ed' 
  AND (
    token = 'Jv18j3m+k/fRx+ztAskE+xCJVBz6vffLp2HVBjgOrPU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036