UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q9JDlsk9bLpaxpQElNpGbcNoOkAFbOKyF9AjTipKD6o=' 
WHERE 
  key_id = '6ba273b466c685cbd2254dcd044322840b7c778ae0b77b7746c9652ee8501067' 
  AND (
    token = 'q9JDlsk9bLpaxpQElNpGbcNoOkAFbOKyF9AjTipKD6o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035