UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'buKJHYVr1871DCQDnVq1YtpBvt9JM1wuq/P4TJ75YHE=' 
WHERE 
  key_id = 'a5294554730f4acc52f9723dc05b5efa33ccaf9acefcf7bb94c76e227de37fd7' 
  AND (
    token = 'buKJHYVr1871DCQDnVq1YtpBvt9JM1wuq/P4TJ75YHE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052