UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lhgCRyn5M7tVMV9bRLsgTXgOwD7+wn2vHCmvV/LPPfk=' 
WHERE 
  key_id = 'cbc5cd01ae937d0f522d304ff222bbfeb216da8613c72ac4954102e10f99628f' 
  AND (
    token = 'lhgCRyn5M7tVMV9bRLsgTXgOwD7+wn2vHCmvV/LPPfk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037